import javax.swing.plaf.nimbus.State;
import javax.swing.text.html.CSS;
import java.util.Scanner;
class Student {
    public void learn() {
        System.out.println("学习！！");
    }
}
public class ThradDemo17 {
    public static void main(String[] args) {
        Object object = new Object();
        Thread t1 = new Thread(() -> {
            for (int i = 0; i < 100; i++) {
                synchronized (object) {
                    System.out.println("hello t1");
                }
            }
        });
        Thread t2 = new Thread(() -> {
            for (int i = 0; i < 100; i++) {
                synchronized (object) {
                    System.out.println("hi t2");
                }
            }
        });
        t1.start();
        t2.start();
    }
}
